home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / c / moustr.com / MOUSTRAP.H < prev    next >
Encoding:
C/C++ Source or Header  |  1988-09-19  |  5.0 KB  |  183 lines

  1. /***********************************************************************/
  2. /*                                                                     */
  3. /*    MOUSE.H                                                          */
  4. /*                                                                     */
  5. /*   Author: James M. Curran                                           */
  6. /*   Copyright (c) 1988, James M. Curran                               */
  7. /*                                                                     */
  8. /***********************************************************************/
  9. /* Created : Friday, September  9, 1988 at 10:18 AM                    */
  10. /*                                                                     */
  11. /* Revision: 1.0   Last Revised: Sunday, September 11, 1988 @ 5:39 PM  */
  12. /***********************************************************************/
  13.  
  14.  
  15. #define M_Undefined        0
  16.  
  17. /* Paging Method Types        */
  18. #define M_Overlaid_Pages    16
  19. #define M_Single_Pages        65535
  20.  
  21.  
  22. /*  Page Coordinate Types    */
  23. #define M_Text_Coord        3
  24. #define M_Graphic_Coord        0
  25.  
  26. /*  Buttons            */
  27. #define M_Left            0
  28. #define M_Right            1
  29. #define    M_Center        2
  30. #define M_Middle        2
  31.  
  32. /*  Cursor direction (for limits)*/
  33. #define    M_HORIZ            1
  34. #define    M_VERT            2
  35.  
  36.  
  37. #define MERROR               -1    /* An error occured (return value) */
  38. #define MNOERROR        0    /* NO error occured (return value) */
  39.  
  40. /*    Errors (in M_ERROR if return value was MERROR)                 */
  41. #define    MNOINIT            1    /* M_Page_Method not initialized   */
  42. #define MNOSPACE        2    /* Insuficent memory to add item   */
  43. #define MTOOMANY        3    /* Attemp to create more than 16 pages */
  44. #define MNOREINIT        4    /* Attempt to execute DEFINE...SYSTEM twice */
  45. #define MNOTPAGE        5    /* Page referenced hasn't been defined */
  46. #define MNOTBUTTON        6    /* Button referenced-- not defined */
  47. #define MNOMOUSE        7    /* There's no mouse attached       */
  48. #define MBUTTONRET        8    /* Button define with return value */
  49. #define MNOHOTSPOT              9       /* Hot Spot referenced-- not defined*/
  50. #define MNOACTIVE           10    /* There is no page active       */
  51.      
  52.  
  53. #define    TC(char,fore,back) char+fore*256+back*4096
  54.  
  55.  
  56. typedef unsigned    mouse_t;
  57.  
  58.     struct    M_P_D {
  59.             mouse_t    Page_ID;
  60.             mouse_t    Top;
  61.             mouse_t    Left;
  62.             mouse_t    Right;
  63.             mouse_t    Bottom;
  64.             mouse_t    Coord_Type;
  65.             struct    M_P_D        *Next;           
  66.             };
  67.  
  68. #define M_Page_Definition struct M_P_D
  69.  
  70.     struct    M_B_D {
  71.             mouse_t    Page_ID;
  72.             mouse_t    Button;
  73.             mouse_t    Return_Value;
  74.             struct  M_B_D        *Next;
  75.             };
  76.  
  77. #define    M_Button_Definition struct M_B_D
  78.  
  79.  
  80.     struct    M_HS_D {
  81.             mouse_t    HS_ID;
  82.             mouse_t    Page_ID;
  83.             mouse_t Button;
  84.             mouse_t    Top;
  85.             mouse_t    Left;
  86.             mouse_t    Right;
  87.             mouse_t    Bottom;
  88.             mouse_t    Return_Value;
  89.             struct    M_HS_D        *Next;
  90.             };
  91.  
  92. #define    M_Hot_Spot_Definition struct M_HS_D
  93.  
  94.  
  95.  
  96.  
  97. /*    Mouse Control Primatives            */
  98.  
  99. mouse_t cdecl Check_Mouse(void);
  100.  
  101. void     cdecl Show_Mouse(void);
  102.  
  103. void     cdecl Hide_Mouse(void);
  104.  
  105. mouse_t cdecl Get_Mouse_Position(mouse_t  *, mouse_t  *);
  106.  
  107. void     cdecl Set_Mouse_Position(mouse_t X, mouse_t Y);
  108.  
  109. mouse_t cdecl Get_Mouse_Press(mouse_t Button, mouse_t  *count, mouse_t  *X,\
  110.              mouse_t  *Y);
  111.  
  112. mouse_t cdecl Get_Mouse_Release(mouse_t Button, mouse_t  *count, mouse_t  *X,\
  113.              mouse_t  *Y);
  114.  
  115. void     cdecl Set_Mouse_Limit(mouse_t Direction, mouse_t Minimum,\
  116.              mouse_t Maximum);
  117.  
  118. void    cdecl Set_Mouse_Graphic_Cursor(mouse_t Hot_x, mouse_t Hot_Y,\
  119.              unsigned long (*Mask)[]);
  120. void    cdecl Set_Mouse_Text_Cursor(mouse_t typ, mouse_t p1, mouse_t p2);
  121.  
  122. void    cdecl Get_Mickeys(mouse_t *X, mouse_t *Y);
  123.  
  124.  
  125.  
  126. /*    Advanced Mouse Control Routines            */
  127.  
  128.  
  129. extern  mouse_t cdecl Define_Mouse_System(mouse_t Page_Type);
  130.  
  131. extern  mouse_t cdecl Clear_All_Mouse_Definitions(void );
  132.  
  133. extern  mouse_t cdecl Add_Mouse_Page(mouse_t Page_Type,mouse_t Top,
  134.             mouse_t Left,mouse_t Bottom,mouse_t Right);
  135.  
  136. extern  mouse_t cdecl Delete_Mouse_Page(mouse_t Page_ID);
  137.  
  138. extern  mouse_t cdecl Activate_Mouse_Page(mouse_t Page_ID);
  139.  
  140. extern  mouse_t cdecl DeActivate_Mouse_Page(mouse_t Page_ID);
  141.  
  142. extern  mouse_t cdecl Clear_Mouse_Pages(void );
  143.  
  144. extern  mouse_t cdecl Add_Mouse_Button(mouse_t Page_ID,mouse_t Button,
  145.             mouse_t Return_Value);
  146.  
  147. extern  mouse_t cdecl Delete_Mouse_Button(mouse_t Page_ID,mouse_t Button);
  148.  
  149. extern  mouse_t cdecl Add_Mouse_Hot_Spot(mouse_t Page_ID,mouse_t Button,
  150.             mouse_t top, mouse_t left,mouse_t bottom,
  151.             mouse_t right,mouse_t ret_value);
  152.  
  153. extern  mouse_t cdecl Delete_Mouse_Hot_Spot(mouse_t HS_ID);
  154.  
  155. extern  mouse_t cdecl Read_Mouse(void );
  156.  
  157.  
  158. /*    Global variables available for use in application programs    */
  159.  
  160.     extern    mouse_t    M_Paging_Method; /* Overlaid, Single, or Undefined */
  161.     extern    mouse_t    M_Error;     /* Error Condition           */
  162.     extern    mouse_t    _mouse_there;     /* 0=No Mouse, 2 or 3= # of buttons*/
  163.  
  164.  
  165. /*    "Force" automatic use of ?MOUSE.LIB during link            */
  166.  
  167. #if M_I86SM
  168. #pragma comment(lib,"SMouse") 
  169. #endif
  170.  
  171. #if M_I86CM
  172. #pragma comment(lib,"CMouse") 
  173. #endif
  174.  
  175. #if M_I86MM
  176. #pragma comment(lib,"MMouse") 
  177. #endif
  178.  
  179. #if M_I86LM
  180. #pragma comment(lib,"LMouse") 
  181. #endif    
  182.  
  183.